package kr.jin.zeroprojectone;

import java.text.SimpleDateFormat;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {

	public DBHelper(Context context) {
		super(context, "TimeDB.db", null, 1);	
	}

	@Override
	public void onCreate(SQLiteDatabase db) {		
		db.execSQL("CREATE TABLE step1 (_id INTEGER PRIMARY KEY AUTOINCREMENT, " + 
				"date1 TEXT, activiryName1 TEXT, time1 INTEGER);");
		db.execSQL("CREATE TABLE step2 (_id INTEGER PRIMARY KEY AUTOINCREMENT, " + 
				"date2 TEXT, activiryName2 TEXT, time2 INTEGER);");
		db.execSQL("CREATE TABLE step3 (_id INTEGER PRIMARY KEY AUTOINCREMENT, " + 
				"date3 TEXT, activiryName3 TEXT, time3 INTEGER);");
		db.execSQL("CREATE TABLE step4 (_id INTEGER PRIMARY KEY AUTOINCREMENT, " + 
				"date4 TEXT, activiryName4 TEXT, totalTime4 TEXT, startTime4 TEXT, stopTime4 TEXT);");
		db.execSQL("CREATE TABLE step6 (_id INTEGER PRIMARY KEY AUTOINCREMENT, " + 
				"date6 TEXT, activiryName6 TEXT, totalTime6 TEXT, startTime6 TEXT, stopTime6 TEXT);");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS step1");
		db.execSQL("DROP TABLE IF EXISTS step2");
		db.execSQL("DROP TABLE IF EXISTS step3");
		db.execSQL("DROP TABLE IF EXISTS step4");
		db.execSQL("DROP TABLE IF EXISTS step6");
		onCreate(db);
	}

}
